﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Bestlife.ERP.DataAccess;
using System.Data.SqlClient;

/// <summary>
/// Summary description for Diamand_to_crownTb
/// </summary>
/// 
namespace Bestlife.ERP.BusinessRules
{
    public class Diamand_to_crownTb
    {
        //Bestlife.ERP.Entities.E_D_toCD listdiamand = new Bestlife.ERP.Entities.E_D_toCD();
        //Bestlife.ERP.Entities.E_D_toCD listSdiamand = new Bestlife.ERP.Entities.E_D_toCD();
        //Bestlife.ERP.Entities.E_D_toCD listSEdiamand = new Bestlife.ERP.Entities.E_D_toCD();
        //Bestlife.ERP.Entities.E_D_toCD listCdiamand = new Bestlife.ERP.Entities.E_D_toCD();

        List<string> listdiamand = new List<string>();
        List<string> listSdiamand = new List<string>();
        List<string> listSEdiamand = new List<string>();
        List<string> listCdiamand = new List<string>();
        SqlDataReader rdRStatus;

        public Diamand_to_crownTb()
        {
            //
            // TODO: Add constructor logic here
            //
        }


        public List<string> Returndiamandlist()
        {
            listdiamand.Clear();

            try
            {//try

                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);

                String sqlstatus = "SELECT  User_id  from Diamond";

                rdRStatus = clsCon.ReadTable(sqlstatus);


                while(rdRStatus.Read())
                {
                    listdiamand.Add(rdRStatus["User_id"].ToString());
                }


            }//try

            catch (Exception)
            {

            }
            finally
            {
                rdRStatus.Close();

            }
            

            return listdiamand;
        }

        //SDiamand - Select All SDn's

        public List<string> ReturnSdiamandlist()
        {
            listSdiamand.Clear();

            try
            {//try

                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);

                String sqlstatus = "SELECT  User_id  from SD";

                rdRStatus = clsCon.ReadTable(sqlstatus);


                while (rdRStatus.Read())
                {
                    listSdiamand.Add(rdRStatus["User_id"].ToString());
                }


            }//try

            catch (Exception err)
            {

            }
            finally
            {
                rdRStatus.Close();

            }


            return listSdiamand;
        }


        //SEDiamand - Select All SEDn's

        public List<string> ReturnSEdiamandlist()
        {
            listSEdiamand.Clear();

            try
            {//try

                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);

                String sqlstatus = "SELECT  User_id  from SED";

                rdRStatus = clsCon.ReadTable(sqlstatus); 


                while (rdRStatus.Read())
                {
                    listSEdiamand.Add(rdRStatus["User_id"].ToString());
                }


            }//try

            catch (Exception err)
            {

            }
            finally
            {
                rdRStatus.Close();

            }


            return listSEdiamand;
        }

        //CDiamand - Select All CDn's


        public List<string> ReturnCdiamandlist()
        {
            listCdiamand.Clear();

            try
            {//try

                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);

                String sqlstatus = "SELECT  User_id  from C_Diamond";

                rdRStatus = clsCon.ReadTable(sqlstatus);


                while (rdRStatus.Read())
                {
                    listCdiamand.Add(rdRStatus["User_id"].ToString());
                }


            }//try

            catch (Exception err)
            {

            }
            finally
            {
                rdRStatus.Close();

            }


            return listCdiamand;
        }

    }
}